package org.example.alicloud.controller;

import com.alibaba.nacos.api.config.annotation.NacosValue;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author gaoqiang
 */
@RestController
@RefreshScope // nacos 动态刷新
public class ConfigClientController {
    //从配置中心获取config.info的值
    @Value("${config.info}")
    private String configInfo;

    @Value("${spring.profiles.active}")
    private String profile;

    @GetMapping("/config/info")
    public String getConfigInfo(){
        return configInfo + "|" + profile;
    }
}
